package br.edu.ufcg.splab.techniques.reduction.functions.similarity;

import br.edu.ufcg.splab.generator.TestCase;

/**
 * This function returns the similarity of two test cases using text compression.
 * 
 * We convert to a similarity measure by returning 1.0 - min(NCD(x, y), 1.0).
 */
public class NormalisedCompression implements DistanceFunction{

	public double getSimilarity(TestCase path1, TestCase path2){
		NormalisedCompressionDistance ncd = new NormalisedCompressionDistance();
		return 1.0 - ncd.getSimilarity(path1, path2);
	}
	
	/**
     * Provide a string representation of the similarity function to be written.
     * @return The string representation of the similarity function.
     */
	public String getFunctionName(){
		return "NC";
	}
	
}
